<template>
    <van-popup v-model:show="showPopup" position="bottom" round @closed="onPopupClosed">
        <div class="share-pop">
            <div class="list">
                <div class="item" @click="onConfirmShareType('video')">
                    <div class="outer">
                        <p>视频介绍</p>
                    </div>
                </div>
                <div class="item" @click="onConfirmShareType('text')">
                    <div class="outer">
                        <p>文字介绍</p>
                    </div>
                </div>
            </div>
            <div class="fe-bottom">
                <div class="confirm" @click="onPopupClosed">
                    取消
                </div>
            </div>
        </div>
        <div class="van-safe-area-bottom"></div>
    </van-popup>
</template>

<script lang="ts" setup>
import { ref, watch } from 'vue';
import { Popup as VanPopup } from 'vant';

const props = defineProps({
    isShow: {
        type: Boolean,
        require: true,
        default: false,
    },
});


const emit = defineEmits<{(e: 'close'): void;(e: 'confirm', value: string): void; }>();

const showPopup = ref(false);

const onPopupClosed = () => {
    emit('close');
};

const onConfirmShareType = (shareType:string) => {
    emit('confirm', shareType);
};

watch(
    () => props.isShow,
    (newVal) => {
        showPopup.value = newVal;
    }
);
</script>

<style scoped lang="scss">
.share-pop {
    background: #f8f8f8;

    .fe-title {
        display: flex;
        padding-right: 12px;
        margin-top: 20px;
        background: #ffffff;

        h3 {
            height: 22px;
            // font-family: PingFangSC-SNaNpxibold;
            font-weight: 600;
            font-size: 16px;
            color: #333333;
            text-align: center;
            flex: 1;
        }
    }

    .list {
        padding: 0;
        display: flex;
        justify-content: space-between;
        background: #ffffff;
        flex-direction: column;

        .item {
            flex: 1;
            display: flex;
            justify-content: center;
            border-bottom: 1px solid #f2f2f2;

            .outer {
                text-align: center;

                div {
                    width: 64px;
                    height: 64px;
                    background: #f3f6fa;
                    border-radius: 50%;
                    display: flex;
                    justify-content: center;
                    align-items: center;

                    img {
                        width: 38px;
                        height: 38px;
                    }
                }
                p {
                    height: 24px;
                    display: inline-block;
                    font-weight: 400;
                    font-size: 14px;
                    color: #333;
                    line-height: 24px;
                    margin: 16px 0;
                }
            }
        }
    }

    .fe-bottom {
        height: 48px;
        margin-top: 10px;
        text-align: center;
        line-height: 48px;
        font-weight: 400;
        font-size: 14px;
        color: #b5b5b5;
        background: #ffffff;
        padding-bottom: 39px;
    }
}
</style>

